package org.keco.shape;

import java.awt.Color;
import java.awt.Component;

public abstract class AbstractShape extends Component {

	private static final long serialVersionUID = -8795198684021189920L;

	public static final Color DEFAULT_COLOR = Color.BLACK;
	public static final int DEFAULT_LINE_WIDTH = 1;
	public static final int DEFAULT_ZOOM = 1;

	private Color color = DEFAULT_COLOR;
	private int lineWeight = DEFAULT_LINE_WIDTH;
	private double zoom = DEFAULT_ZOOM;
	private int length;

	public Color getColor() {
		return color;
	}

	public void setColor(Color color) {
		this.color = color;
	}

	public int getLineWeight() {
		return lineWeight;
	}

	public void setLineWeight(int lineWeight) {
		this.lineWeight = lineWeight;
	}

	public int getLength() {
		return length;
	}

	protected void setLength(int length) {
		this.length = length;
	}

	public double getZoom() {
		return zoom;
	}

	public void setZoom(double zoom) {
		this.zoom = zoom;
	}

	public void selectShape() {
		this.color = Color.BLUE;
		this.lineWeight = 2;
	}

	public void deselectShape() {
		this.color = DEFAULT_COLOR;
		this.lineWeight = DEFAULT_LINE_WIDTH;
	}

	public abstract boolean containsPoint(Point p);
}
